package com.java.comprehensive.design.building_modelling.singleton_pattern;

/**
 * 饿汉式：静态代码块方式创建
 */
public class SingletonDemo_2 {
    //私有构造方法
    private SingletonDemo_2() {
    }

    private static SingletonDemo_2 INSTANCE;

    //在静态代码块中复制，静态代码块先加载
    static {
        INSTANCE = new SingletonDemo_2();
    }

    public SingletonDemo_2 getInstance() {
        return INSTANCE;
    }

}
